You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing training@inductiveautomation.com.
Version:
LESSON LIST
-
4:38Parameters
-
3:35Basic SQL Query
-
3:13SQL Query
-
1:20Named Queries in Reports
-
2:23Tag Historian Query
-
2:06Tag Calculation Query
-
2:29Alarm Journal Query
-
1:27Static CSV
-
5:42Scripting Data Source
-
4:10Nested Queries
Take Topic Challenge
LESSON
Tag Calculation Query
Description
The Tag Calculation Data Source gives you the ability to quickly determine the average, sum, and maximum values from tag history.
Video recorded using: Ignition 8.1
Transcript
(open in window)[00:00] In this lesson, I'll show you how to import aggregated tag history data into your report with the tag calculation query data source. From the Data tab, the first thing you'll need to do is create a new data source and select Tag Calculation Query. The available historical tags window will list your historical providers and you can drill into them to find your historical tags. I'm storing tag history on some tags that generate random values that I'd like to add to my report. Once I find my tags, I'll drag them over to the selected historical tags window. Next thing you'll need to do is select the calculations to run against these tags. I'm going to choose Time-weighted Average sum and maximum. Next you can either choose a historical date range that uses start and end date bindings or you can choose a real-time date range where you could specify the most recent number of your time unit of choice. For example, you could pull the most recent 12 hours or seven days, etc. I'll go with the historical day range that uses my start date and end date parameters.
[01:08] I'll move over to the Design tab to show you what it looks like to add this data to your report. I have a table here that is configured for my tag_calc data source, and that has a column set up for each of the calculations. If we look at the data source in the key browser, you can see the different keys that I have access to. You'll notice that there are keys for each calculation, but the individual tags aren't listed. However, there is a tag path key here. When I drag this into one of the columns, this will be populated with the tag path/alias value. This is assigned on the data tab. I'll head over to the Preview tab and we can see what this looks like. Let's say that I don't like the tag path in the report here and this value actually represents a temperature. I can head back over to the Data tab and modify this data source. I can change the Data Key Alias here to temperature and when I go back to the Preview tab, you can see that it now lists the new alias.